package cn.schoolwow.quickdao.module.initial.flow.database;

import cn.schoolwow.quickflow.domain.FlowContext;
import cn.schoolwow.quickflow.flow.BusinessFlow;

public class SetDatabaseNameFlow implements BusinessFlow {
    @Override
    public void executeBusinessFlow(FlowContext flowContext) throws Exception {
        String jdbcUrl = (String) flowContext.checkData("jdbcUrl");

        String databaseName = jdbcUrl.substring(jdbcUrl.lastIndexOf("/")+1, jdbcUrl.contains("?")?jdbcUrl.indexOf("?"):jdbcUrl.length());
        flowContext.putTemporaryData("databaseName", databaseName);
    }

    @Override
    public String name() {
        return "设置数据库名称";
    }
}
